#include <bits/stdc++.h>

#define in read()
#define fi first
#define se second
#define pii pair<int,int>
#define pb push_back
#define vec vector<int>
#define y1 y_____hahahaha_____1

using namespace std;

typedef long long ll;
typedef double db;
typedef unsigned long long ull;
typedef long double ldb;

ll read(){ll x = 0,sgn = 1;char ch = getchar();for(;!isdigit(ch);ch = getchar()) if(ch == '-') sgn = -1;for(;isdigit(ch);ch = getchar()) x = (x << 1) + (x << 3) + (ch ^ 48); return x * sgn;}

const int N = 55;
const int mod = 1e9 + 7;

ll qp(ll x,int t){ll res = 1;for(;t;t >>= 1,x = x * x % mod) if(t & 1) res = res * x % mod; return res;}

ll a[N],n,m,S[N][N];

ll calc(ll n,ll m){
	ll res = 0;
	for(int j = 0;j <= m;j++){
		ll t = 1;
		for(int i = 0;i < j + 1;i++) t = t * (n + 1 - i) % mod;
		t = t * qp(j + 1,mod - 2) % mod;
		res = (res + S[m][j] * t % mod) % mod;
	}
	return res;
}

int main(){
#ifndef ONLINE_JUDGE
	freopen("1.in","r",stdin);
#endif
	S[0][0] = 1;
	for(int i = 1;i < 55;i++)
		for(int j = 1;j <= i;j++)
			S[i][j] = (S[i-1][j-1] + S[i-1][j] * j % mod) % mod;
	for(int t = in;t;t--){
		n = in,m = in; for(int i = 1;i <= m;i++) a[i] = in; sort(a + 1,a + m + 1);
		ll ans = 0;
		for(int i = 0;i <= m;i++){
			ans = (ans + calc((n - a[i]) % mod,m + 1)) % mod;
			for(int j = i + 1;j <= m;j++) ans = (ans - qp((a[j] - a[i]) % mod,m + 1) + mod) % mod;
		}
		printf("%lld\n",ans);
	}
	return 0;
}
